<!-- 模板列表的头部 -->
<template>
  <t-space>
    <t-input @change="searchHandle" clearable style="width: 200px">
      <template #prefix-icon>
        <search-icon size="20px" />
      </template>
    </t-input>
    <t-button @click="createHandle">
      <template #icon>
        <add-icon size="20px" />
      </template>
      创建模板
    </t-button>
  </t-space>
</template>

<script>
import { AddIcon, SearchIcon } from 'tdesign-icons-vue';
import { debounce } from '@/utils';

export default {
  name: 'RAT-Header',
  components: { AddIcon, SearchIcon },
  methods: {
    createHandle() {
      this.$router.push('/risk-assessment/template/create');
    },
    searchHandle: debounce(function fn(val) {
      this.$emit('searchHandle', val);
    }, 1000),
  },
};
</script>
